export const queryString = (params) => '?' + Object.keys(params).map(i => `${i}=${params[i]}`).join('&')

const  request = (url,data,query='',method = 'GET') => new Promise((ok,err)=> {
    wx.request({
        url:url +query,
        data,
        method,
        success:ok,
        fail:err,
        complete:() => {}
        

    })
})
export const get = (url,data)=>request(url,data)

export const post = (url,data,queryObj = {})=>request(url,data,queryString(queryObj),'POST')

